package com.practices2.view;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.graphics.RectF;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.widget.RelativeLayout;

public class TransparentsRelativelayout extends RelativeLayout {
	private Paint innerPaint, borderPaint;

	public TransparentsRelativelayout(Context context, AttributeSet attrs) {
		super(context, attrs);
		initPaint();
	}

	private void initPaint() {
		
		innerPaint = new Paint();
		innerPaint.setARGB(225, 75, 75, 75); // gray
		innerPaint.setAntiAlias(true);

		borderPaint = new Paint();
		borderPaint.setARGB(255, 255, 255, 255);
		borderPaint.setAntiAlias(true);
		borderPaint.setStyle(Style.STROKE);
		borderPaint.setStrokeWidth(2);

	}

	@Override
	protected void dispatchDraw(Canvas canvas) {
		
		RectF f=new RectF();
		f.set(0, 0, getMeasuredWidth(), getMeasuredHeight());
		canvas.drawRoundRect(f, 5, 5, innerPaint);
		canvas.drawRoundRect(f, 5, 5, borderPaint);
		super.dispatchDraw(canvas);
	}

}
